/**══════════════════════════════════╗
*作    者：songbaobao                                                 ║
*职    业：我以我血荐轩辕                                              ║                                              
*CSND地址：https://blog.csdn.net/weixin_43949535                       ║
**GitHub ：https://github.com/TsinghuaLucky912/My_own_C-_study_and_blog║
*═══════════════════════════════════╣
*创建时间：                                                           
*功能描述：                                                            
*                                                                      
*                                                                      
*═══════════════════════════════════╣
*结束时间:                                                           
*═══════════════════════════════════╝
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//              西南\./联大               \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
*/
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <ctype.h>
#include <queue>
#include <list>
#include <map>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int myFibonacci(int n)
{
	int first = 1, second = 1, sum = 1;
	if (n == 1 || n == 2)
		return 1;
	n -= 1;
	while (--n)
	{
		sum = first + second;
		first = second;
		second = sum;
	}
	return sum;
}


#if F
#define ROW 4
#define COL 5
#endif

int main()
{
#if A
	int n = 100, sum = 0;
	while (n)
	{
		sum += n--;
	}
	printf("%d\n", sum);
#endif

#if B
	int n = 100, sum = 0;
	do
	{
		sum += n--;
	} while (n);
	printf("%d\n", sum);
#endif

#if C
	int n = 100, sum = 0;
	for (; n > 0; --n)
	{
		sum += n;
	}
	printf("%d\n", sum);
#endif

#if D
	int N, sum = 0;
	scanf_s("%d", &N);
	for (int i = 0;;)
	{
		if (i == N)
			break;
		sum += ++i;
	}
	printf("%d\n", sum);
#endif

#if E
	int N, sum = 0;
	for (int i = 0;;)
	{
		if (sum > 1000)
			break;
		sum += ++i;
		N = i;
	}
	printf("%d\n", N);
#endif

#if F
	for (int i = 1; i <= ROW; ++i)
	{
		for (int j = 1; j <= COL; ++j)
		{
			printf("%3d", i * j);
		}
		printf("\n");
	}
#endif

#if G
	int flag = 1;
	double sum = 0, n = 1;

	while (1 / n >= 1e-6)
	{
		sum += (1 / n) * flag;
		n += 2;
		flag *= -1;
	}
	printf("PI=%.8f\n", 4 * sum);
#endif

#if H
	int first = 1, second = 1, sum = 1, n;
	scanf_s("%d", &n);
	if (n == 1 || n == 2)
		return 1;
	if (n <= 50)
	{
		n -= 1;
		while (--n)
		{
			sum = first + second;
			first = second;
			second = sum;
		}
	}
	printf("%d\n", sum);
#endif

	int n = 20, i = 2, up, down;
	double sum = 0;
	while (n--)
	{
		up = myFibonacci(i + 1);
		down = myFibonacci(i);
		sum += (double)up / (double)down;
		i++;
	}
	printf("%.6f\n", sum);
	return 0;
}
/**
*备用注释：
*
*
*
*/